﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="ZLDC.Estate.UserControl.WebUserControl1" %>

<link href="../js/jquery.autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>

<script src="../js/jquery.autocomplete/jquery.autocomplete.min.js" type="text/javascript"></script>

<input id="umainclass" title='拼音首字母提示' style="width: 100px" name="umainclass" onblur="selDU()" />
<div id="dvDept" style="overflow: auto; z-index: 2000; position: absolute; display: none;
    border: 1px; border-style: outset; background-color: #ffffff; height: 145px;
    width: 200px; text-align: left;">
    <asp:Literal ID="ltlDeptTree" runat="server"></asp:Literal>
</div>

<input id="utxtmain" name="utxtmain" type="hidden" />   <!-- 部门名称 -->
<input id="utxdeptid" name="utxdeptid" type="hidden" /> <!-- 部门Id -->

<input id="utxtsub" name="utxtsub" type="hidden" />     <!-- 姓名[工号,部门] -->


<script type="text/javascript">

    //部门--自动填充
    $("#umainclass").autocomplete("../Ajax/GetDeptAuto.aspx", { minChars: 2, extraParams: { dpname: function () { return escape($('#umainclass').val()); } }, scrollHeight: 200, width: 150, max: 100, parse: function (data) {
        if (data == "" || data == undefined)
            return false;

        return $.map(eval(data), function (row) {
            return {
                data: row,
                value: row.id,
                result: row.name
            }
        });
    },
        formatItem: function (item) {
            return item.name;
        }

    });

    $("#umainclass").result(function (event, data, formatted) {
        if (data == null) {
            return;
        }
        // 选中下拉中某行的事件
        document.getElementById('utxtmain').value = data.name;
        document.getElementById("utxdeptid").value = data.id;
    });

</script>